package com.one.group.admin.mapper;

import com.mybatisflex.core.BaseMapper;
import com.one.group.model.dto.WorkAssignmentQueryDto;
import com.one.group.model.entity.WorkAssignment;
import com.one.group.model.vo.WorkAssignmentListVo;

import java.util.List;

/**
 * 派工管理Mapper接口
 */

public interface WorkAssignmentMapper extends BaseMapper<WorkAssignment> {

    /**
     * 根据查询条件查询派工列表
     * @param workAssignmentQueryDto 查询条件
     * @return 派工列表
     */
    List<WorkAssignmentListVo> findWorkAssignmentByQueryDto(WorkAssignmentQueryDto workAssignmentQueryDto);

    /**
     * 根据ID查询派工
     * @param id 派工ID
     * @return 派工信息
     */
    WorkAssignment findById(Long id);
    
    /**
     * 根据报修单ID查询派工单
     * @param repairReportId 报修单ID
     * @param tenantId 租户ID
     * @return 派工单信息
     */
    WorkAssignment findByRepairReportId(Long repairReportId, Long tenantId);

    /**
     * 插入派工
     * @param workAssignment 派工信息
     * @return 影响行数
     */
    int insertWorkAssignment(WorkAssignment workAssignment);

    /**
     * 更新派工
     * @param workAssignment 派工信息
     * @return 影响行数
     */
    int updateWorkAssignment(WorkAssignment workAssignment);

    /**
     * 删除派工（逻辑删除）
     * @param id 派工ID
     * @return 影响行数
     */
    int deleteWorkAssignment(Long id);
}